package com.uobgroup.ews.uam.core.enums;

import java.util.ArrayList;
import java.util.List;

/**
 * Database operation's types for auditing
 * @author ndduy
 *
 */
public enum OperateType {
   
   INSERT,UPDATE,DELETE,SELECT;
   
   public static OperateType getType(String type){
      if(type != null){
         type = type.toUpperCase();
         for(OperateType oType : OperateType.values()){
            if(oType.name().equals(type)){
               return oType;
            }
         }
      }
      return null;
   }
   
   public static List<String> getActionList(boolean includeBlankItem){
      List<String> result = new ArrayList<String>();
      if(includeBlankItem){
         result.add(" ");
      }
      for(OperateType oType : OperateType.values()){
         result.add(oType.name());
      }
      return result;
   }
}
